import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Test {

    public int numJewelsInStones(String jewels, String stones) {
        Set<Character> set = new HashSet<>();

        for (int i = 0; i < jewels.length(); i++) {
            char ch = jewels.charAt(i);
            set.add(ch);
        }
        int count = 0;

        for (int i = 0; i < stones.length(); i++) {
            //char ch = stones.charAt(i);
            if (set.contains(stones.charAt(i))) {
                count++;
            }
        }
        return count;
    }

    /*public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        char[] array = new char[0];
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String a = in.nextLine();
            String b = in.nextLine();
            Set<Character> set = new HashSet<>();
            for (int i = 0; i < b.length(); i++) {
                char ch = b.charAt(i);
                set.add(ch);
            }
            array = new char[a.length()];
            int size = 0;
            for (int i = 0; i < a.length(); i++) {
                char ch = a.charAt(i);
                if (!set.contains(ch)) {
                    array[size++] = ch;
                }
            }
        }
        System.out.println(Arrays.toString(array));
    }*/

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str1 = in.nextLine();
            String str2 = in.nextLine();
            func(str1, str2);
        }
    }

    public static void func(String str1, String str2) {
        Set<Character> set = new HashSet<>();
        str1 = str1.toUpperCase();
        str2 = str2.toUpperCase();

        for (int i = 0; i < str2.length(); i++) {
            set.add(str2.charAt(i));
        }
        Set<Character> Newset = new HashSet<>();
        for (int i = 0; i < str2.length(); i++) {
            char ch = str1.charAt(i);
            if (!set.contains(i) && !Newset.contains(i)) {
                Newset.add(ch);
                System.out.print(ch);
            }
        }
    }


    public int firstUniqChar(String s) {
        Set<Character> set = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (!set.contains(ch)) {
                set.add(ch);
            } else {
                set.remove(ch);
            }
        }
        return set.size();


    }


}
